define(['util'], function (Util) {
    function ViewModel(params) {
        var scope = this;

        scope.pages = [];
        var storagePeriodDics = Util.ajaxGetSync({url:Util.getRestUrl('/dics'),data:{type:'保管期'}});

        for(var i=0;i<params.data.length;++i){
            if(i%8 == 0){
                scope.pages.push(Array.factory.initWithSame({value:'',count:8}));
            }

            var storagePeriodDic = storagePeriodDics.data.findItemByField({name:'value',value:params.data[i].storagePeriod});

            params.data[i]['storagePeriodT'] = storagePeriodDic?storagePeriodDic.text:'';
            scope.pages[scope.pages.length -1][i%8] = params.data[i];
        }
    }

    return ViewModel;
});
